home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / tools / nwtp06 / detach.pas < prev    next >
Pascal/Delphi Source File  |  1996-07-10  |  893b  |  32 lines

  1. Program Detach;
  2.  
  3. { Example for the NwConn unit / NwTP 0.6, (c) 1993,1995 R.Spronk     }
  4.  
  5. { Detach from the fileserver whose name is in parameter #1,
  6.   delete all drivemappings to directories of target server's volumes }
  7.  
  8. Uses nwMisc,nwConn,nwFile;
  9.  
  10. Var ConnId:Byte;
  11.     Srvr:String;
  12. begin
  13. If paramCount<>1
  14.  then begin
  15.       writeln('ERR: Supply name of server to detach from as a parameter.');
  16.       writeln;
  17.       writeln('Detaches from server/ removes all drive mappings to server.');
  18.       writeln('Returns errorlevel 1 when detaching was successful. 0 otherwise.');
  19.       halt(0);
  20.       end;
  21. Srvr:=ParamStr(1);UpString(Srvr);
  22. IF NOT GetConnectionId(Srvr,connId)
  23.  then begin
  24.       writeln('ERR: Not attached to server ',Srvr);
  25.       halt(0);
  26.       end;
  27. DeleteConnectionsDriveMappings(connId);
  28. IF DetachFromFileServer(connId)
  29.  then halt(1)
  30.  else halt(0);
  31. end.
  32.